home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / OpenDoc / ProcessMap / $Headers / CPProcessMap.h next >
Encoding:
C/C++ Source or Header  |  1995-04-28  |  15.8 KB  |  484 lines  |  [TEXT/MPCC]

  1. /*
  2.     File:        CPProcessMap.h
  3.     Contains:    CPProcessMap OpenDoc part editor class definition.
  4.     Written by:    PartMaker
  5.  
  6.     Change History (most recent first):
  7.  
  8.     <3>    4/14/95    JS        Updated for Developer Release 2
  9.     <2>    3/8/95    JS        Updated to b1c13/c14
  10.     <1>    2/2/95    RA        first checked in
  11.     <0>    PartMaker source by E. Soldan, T. Ã‡elik, J. Alfke, R. Adkins, J. Schalk
  12. */
  13.  
  14. #ifndef _PROCESSMAP_
  15. #define _PROCESSMAP_
  16.  
  17. //========================================================================================
  18. // OpenDoc Interfaces
  19. //========================================================================================
  20.  
  21. #ifndef ODDebug
  22. #define ODDebug 0
  23. #endif
  24.  
  25. #ifndef _ALTPOINT_
  26. #include <AltPoint.h>
  27. #endif
  28. #ifndef _EXCEPT_
  29. #include <Except.h>
  30. #endif
  31. #ifndef SOM_Module_OpenDoc_Global_TypesB_defined
  32. #include <ODTypesB.xh>
  33. #endif
  34. #ifndef _USERSRCM_
  35. #include <UseRsrcM.h>
  36. #endif
  37. #ifndef _INFOUTIL_
  38. #include <InfoUtil.h>
  39. #endif
  40. #ifndef _ITEXT_
  41. #include <IText.h>
  42. #endif
  43. #ifndef SOM_ODDraft_xh
  44. #include <Draft.xh>
  45. #endif
  46. #ifndef SOM_ODArbitrator_xh
  47. #include <Arbitrat.xh>
  48. #endif
  49. #ifndef SOM_ODCanvas_xh
  50. #include <Canvas.xh>
  51. #endif
  52. #ifndef SOM_ODPart_xh
  53. #include <Part.xh>
  54. #endif
  55. #ifndef SOM_ODFacet_xh
  56. #include <Facet.xh>
  57. #endif
  58. #ifndef SOM_ODFrame_xh
  59. #include <Frame.xh>
  60. #endif
  61. #ifndef SOM_ODFrameFacetIterator_xh
  62. #include <FrFaItr.xh>
  63. #endif
  64. #ifndef SOM_ODFoci_xh
  65. #include <Foci.xh>
  66. #endif
  67. #ifndef SOM_ODInfo_xh
  68. #include <Info.xh>
  69. #endif
  70. #ifndef SOM_ODPstObj_
  71. #include <PstObj.xh>
  72. #endif
  73. #ifndef SOM_ODShape_xh
  74. #include <Shape.xh>
  75. #endif
  76. #ifndef SOM_ODStdProps_xh
  77. #include <StdProps.xh>
  78. #endif
  79. #ifndef SOM_ODStdTypes_xh
  80. #include <StdTypes.xh>
  81. #endif
  82. #ifndef SOM_ODCmdDefs_xh
  83. #include <CmdDefs.xh>
  84. #endif
  85. #ifndef SOM_ODStorageU_xh
  86. #include <StorageU.xh>
  87. #endif
  88. #ifndef SOM_ODTrnsform_xh
  89. #include <Trnsform.xh>
  90. #endif
  91. #ifndef SOM_ODFocusSet_xh
  92. #include <FocusSet.xh>
  93. #endif
  94. #ifndef SOM_ODFoci_xh
  95. #include <Foci.xh>
  96. #endif
  97. #ifndef SOM_ODMenuBar_xh
  98. #include <MenuBar.xh>
  99. #endif
  100. #ifndef SOM_ODWindow_xh
  101. #include <Window.xh>
  102. #endif
  103. #ifndef SOM_ODWinStat_xh
  104. #include <WinStat.xh>
  105. #endif
  106. #ifndef SOM_ODSession_xh
  107. #include <ODSessn.xh>
  108. #endif
  109. #ifndef _STDDEFS_
  110. #include <StdDefs.xh>
  111. #endif
  112. #ifndef _PLFMDEF_
  113. #include <PlfmDef.h>
  114. #endif
  115. #ifndef _PASCLSTR_
  116. #include <PasclStr.h>
  117. #endif
  118. #ifndef _FOCUSLIB_
  119. #include <FocusLib.h>
  120. #endif
  121. #ifndef _STDTYPIO_
  122. #include <StdTypIO.h>
  123. #endif
  124. #ifndef _STORUTIL_
  125. #include <StorUtil.h>
  126. #endif
  127. #ifndef _ODMEMORY_
  128. #include "ODMemory.h"
  129. #endif
  130. #ifndef _WINUTILS_
  131. #include <WinUtils.h>
  132. #endif
  133. #ifndef _POUTILS_
  134. #include <POUtils.h>
  135. #endif
  136. #ifndef _ISOSTR_
  137. #include <ISOStr.h>
  138. #endif
  139. #ifndef _BNDNSUTL_
  140. #include <BndNSUtl.h>
  141. #endif
  142. #ifndef SOM_ODObjectNameSpace_xh
  143. #include "ObjectNS.xh"
  144. #endif
  145. #ifndef SOM_ODBaseNameSpaceManager_xh
  146. #include <NmSpcMgB.xh>
  147. #endif
  148. #ifndef SOM_ODValueNameSpace_xh
  149. #include "ValueNS.xh"
  150. #endif
  151. #ifndef SOM_ODNameSpaceManager_xh
  152. #include <NmSpcMg.xh>
  153. #endif
  154.  
  155. #ifndef SOM_ODDispatcher_xh
  156. #include <Disptch.xh>
  157. #endif
  158.  
  159. //========================================================================================
  160. // ProcessMap Interfaces
  161. //========================================================================================
  162.  
  163. #ifndef _PROCESSMAPDEF_
  164. #include "ProcessMapDef.h"
  165. #endif
  166. #ifndef _PARTUTILS_
  167. #include "PartUtils.h"
  168. #endif
  169. #ifndef _FRAMELIST_
  170. #include "FrameList.h"
  171. #endif
  172.  
  173. //========================================================================================
  174. // Macintosh ToolBox Interfaces
  175. //========================================================================================
  176.  
  177. #ifndef __ERRORS__
  178. #include <Errors.h>
  179. #endif
  180. #ifndef __RESOURCES__
  181. #include <Resources.h>
  182. #endif
  183. #ifndef __DIALOGS__
  184. #include <Dialogs.h>
  185. #endif
  186. #ifndef __TOOLUTILS__
  187. #include <ToolUtils.h>
  188. #endif
  189.  
  190. //========================================================================================
  191. // Miscellaneous
  192. //========================================================================================
  193.  
  194. #ifndef qTraceEnteringMethods
  195. #define qTraceEnteringMethods 1
  196. #endif
  197.  
  198. #if qTraceEnteringMethods
  199.     #define     EnteringMethod(s) {if (AreTraceKeysDown()) DebugStr((StringPtr)s);}
  200. #else
  201.     #define     EnteringMethod(s)
  202. #endif
  203.  
  204. #ifdef applec
  205. #pragma segment ProcessMap
  206. #endif
  207.  
  208. //========================================================================================
  209. // Constants
  210. //========================================================================================
  211.  
  212. const short kContentStringResID = 5000;
  213. const short kContentStringID    = 1;
  214. const short kAboutTextID        = 2;
  215.  
  216. //========================================================================================
  217. // Forward declarations
  218. //========================================================================================
  219.  
  220. class ODFocusSet;
  221. class ODMenuBar;
  222. class ODSession;
  223. class ODWindow;
  224. class ODFrame;
  225. class ODFacet;
  226. class ODShape;
  227. class ODStorageUnit;
  228. class ODStorageUnitView;
  229. class ODEmbeddedFramesIterator;
  230. class ODLink;
  231. class ODLinkSource;
  232. class ODTypeList;
  233. class ODPart;
  234. class ODDragItemIterator;
  235. class ODCanvas;
  236. class ODExtension;
  237. class ODObjectSpec;
  238.  
  239. //========================================================================================
  240. // CPProcessMap
  241. //========================================================================================
  242. class CMyProcess
  243. {
  244. public:
  245.     CMyProcess(){pName = new char[63];}
  246.     ~CMyProcess(){delete []pName;}
  247.     Boolean IsSameOne(CMyProcess& theProcess)
  248.     {
  249.     Boolean f=true;
  250.         if(lStartAddress != theProcess.lStartAddress) f=false;
  251.         if(lEndAddress   != theProcess.lEndAddress) f=false;
  252.         if(thePSN.highLongOfPSN!= theProcess.thePSN.highLongOfPSN) f=false;
  253.         if(thePSN.lowLongOfPSN != theProcess.thePSN.lowLongOfPSN) f=false;
  254.  
  255.         return f;
  256.     };
  257.     CMyProcess& operator=(CMyProcess& theProcess)
  258.     {
  259.     BlockMoveData(theProcess.pName, this->pName, theProcess.pName[0]+1);
  260.     this->lStartAddress = theProcess.lStartAddress;
  261.     this->lEndAddress   = theProcess.lEndAddress;
  262.     this->thePSN        = theProcess.thePSN;
  263.     return *this;
  264.     };
  265.  
  266.     long lStartAddress;
  267.     long lEndAddress;
  268.     ProcessSerialNumber thePSN;
  269.     char* pName;
  270. };
  271.  
  272. class CPProcessMap
  273. {
  274. public:
  275.     // Constructor, Destructor (CPProcessMap.cpp) =========================================
  276.                 CPProcessMap();
  277.                 ~CPProcessMap();
  278.  
  279.     // ODRefCntObject, ODPersistentObject, Memory Management (CPProcessMap.cpp) ===========
  280.     void          IncrementRefCount        (Environment* ev);
  281.     void        Release                    (Environment* ev);
  282.     void        CloneInto                (Environment* ev, ODDraftKey key,
  283.                                          ODStorageUnit* toSU, ODFrame* scope);
  284.     ODSize        Purge                    (Environment* ev, ODSize size);
  285.  
  286.     // Internalize/Externalize (CPProcessMap.InEx.cpp) ====================================
  287.     void        InitPart                   (Environment* ev, ODStorageUnit* su, ODPart* self);
  288.     void        InitPartFromStorage        (Environment* ev, ODStorageUnit* so, ODPart* self);
  289.     void        PrivInternalizeStateInfo(Environment* ev, ODStorageUnit* storageUnit);
  290.     void        PrivInternalizeContent    (Environment* ev, ODStorageUnit* storageUnit);
  291.     void        Externalize                (Environment* ev);
  292.     void         PrivCheckAndAddProperties    (Environment* ev, ODStorageUnit* storageUnit);
  293.     void         PrivCleanContentProperty    (Environment* ev, ODStorageUnit* storageUnit);
  294.     void        PrivExternalizeStateInfo    (Environment* ev, ODStorageUnit* storageUnit,
  295.                                          ODDraftKey key, ODFrame* scopeFrame);
  296.     void        PrivExternalizeContent        (Environment* ev, ODStorageUnit* storageUnit);
  297.     void        ReleaseAll                 (Environment* ev);
  298.  
  299.     // Imaging (CPProcessMap.Image.cpp) ===================================================
  300.     void        Draw                      (Environment* ev, ODFacet* facet, ODShape* invalidShape);
  301.     void        FacetAdded                 (Environment* ev, ODFacet* facet);
  302.     void        FacetRemoved               (Environment* ev, ODFacet* facet);
  303.     void        GeometryChanged            (Environment* ev, ODFacet* facet,
  304.                                          ODBoolean clipShapeChanged,
  305.                                          ODBoolean externalTransformChanged);
  306.     void        CanvasUpdated             (Environment* ev, ODCanvas* canvas);
  307.     void        CanvasChanged              (Environment* ev, ODFacet* facet);
  308.     void        HighlightChanged          (Environment* ev, ODFacet* facet);
  309.     ODULong        GetPrintResolution        (Environment* ev, ODFrame* frame);
  310.  
  311.     // Part Activation (CPProcessMap.Focus.cpp) ===========================================
  312.     ODBoolean    BeginRelinquishFocus     (Environment* ev, ODTypeToken focus,
  313.                                          ODFrame* ownerFrame, ODFrame* proposedFrame);
  314.     void        CommitRelinquishFocus    (Environment* ev, ODTypeToken focus,
  315.                                          ODFrame* ownerFrame, ODFrame* proposedFrame);
  316.     void        AbortRelinquishFocus     (Environment* ev, ODTypeToken focus,
  317.                                          ODFrame* ownerFrame, ODFrame* proposedFrame);
  318.     void        FocusAcquired            (Environment* ev, ODTypeToken focus,
  319.                                          ODFrame* ownerFrame);
  320.     void        FocusLost                (Environment* ev, ODTypeToken focus,
  321.                                          ODFrame* ownerFrame);
  322.  
  323.     // Binding (CPProcessMap.Bind.cpp) ====================================================
  324.     void        ExternalizeKinds        (Environment* ev, ODTypeList* kindList);
  325.     void        ChangeKind              (Environment* ev, ODType kind);
  326.  
  327.     // UI Events (CPProcessMap.Event.cpp) =================================================
  328.     ODBoolean    HandleEvent                (Environment* ev, ODEventData* event, ODFrame* frame,
  329.                                          ODFacet* facet, ODEventInfo* eventInfo);
  330.     void        AdjustMenus                (Environment* ev, ODFrame* frame);
  331.  
  332.     // ODObject (CPProcessMap.Ext.cpp) ====================================================
  333.     ODBoolean    HasExtension            (Environment* ev, ODType extensionName);
  334.     ODExtension*GetExtension            (Environment* ev, ODType extensionName);
  335.     void        ReleaseExtension        (Environment* ev, ODExtension* extension);
  336.  
  337.     // Layout (CPProcessMap.Frame.cpp) ====================================================
  338.     void        DisplayFrameAdded        (Environment* ev, ODFrame* frame);
  339.     void        DisplayFrameRemoved     (Environment* ev, ODFrame* frame);
  340.     void        DisplayFrameConnected     (Environment* ev, ODFrame* frame);
  341.     void        DisplayFrameClosed         (Environment* ev, ODFrame* frame);
  342.     void        AttachSourceFrame       (Environment* ev, ODFrame* frame,
  343.                                          ODFrame* sourceFrame);
  344.     void        FrameShapeChanged       (Environment* ev, ODFrame* frame);
  345.     void        ViewTypeChanged         (Environment* ev, ODFrame* frame);
  346.     void        PresentationChanged     (Environment* ev, ODFrame* frame);
  347.     void        SequenceChanged         (Environment* ev, ODFrame* frame);
  348.     ODInfoType    ReadPartInfo            (Environment* ev, ODFrame* frame,
  349.                                          ODStorageUnitView* suView);
  350.     void        WritePartInfo           (Environment* ev, ODInfoType partInfo,
  351.                                           ODStorageUnitView* suView);
  352.     void        ClonePartInfo            (Environment *ev, ODDraftKey key,
  353.                                          ODInfoType partInfo,
  354.                                          ODStorageUnitView* suView,
  355.                                          ODFrame* scopeFrame);
  356.     ODID        Open                       (Environment* ev, ODFrame* frame);
  357.                                          
  358.     // Undo (CPProcessMap.Undo.cpp) =======================================================
  359.     void        UndoAction                (Environment* ev, ODActionData* actionState);
  360.     void        RedoAction                (Environment* ev, ODActionData* actionState);
  361.     void        DisposeActionState        (Environment* ev, ODActionData* actionState,
  362.                                          ODDoneState doneState);
  363.     void        WriteActionState          (Environment* ev, ODActionData* actionState,
  364.                                          ODStorageUnitView* suView);
  365.     ODActionData ReadActionState          (Environment* ev, ODStorageUnitView* suView);
  366.     
  367.     // DragAndDrop (CPProcessMap.DD.cpp) ==================================================
  368.     void        FulfillPromise            (Environment* ev, ODStorageUnitView *promiseSUView);
  369.     void        DropCompleted             (Environment* ev, ODPart* destPart,
  370.                                          ODDropResult dropResult);
  371.     ODDragResult DragEnter                 (Environment* ev, ODDragItemIterator* dragInfo,
  372.                                          ODFacet* facet, ODPoint* where);
  373.     ODDragResult DragWithin                (Environment* ev, ODDragItemIterator* dragInfo,
  374.                                          ODFacet* facet, ODPoint* where);
  375.     void        DragLeave                 (Environment* ev, ODFacet* facet, ODPoint* where);
  376.     ODDropResult Drop                      (Environment* ev, ODDragItemIterator* dropInfo,
  377.                                          ODFacet* facet, ODPoint* where);
  378.  
  379.     // Linking (CPProcessMap.Link.cpp) ====================================================
  380.     ODLinkSource* CreateLink              (Environment* ev, ODByteArray* data);
  381.     void        RevealLink                 (Environment* ev, ODLinkSource* linkSource);
  382.     void        LinkUpdated                (Environment* ev, ODLink* updatedLink, ODChangeID id);
  383.  
  384.     void        EmbeddedFrameChanged    (Environment* ev, ODFrame* frame, ODChangeID change);
  385.     void        LinkStatusChanged       (Environment* ev, ODFrame* frame);
  386.  
  387.     // Embedding (CPProcessMap.Embed.cpp) =================================================
  388.     ODFrame*    RequestEmbeddedFrame    (Environment* ev, ODFrame* containingFrame,
  389.                                          ODFrame* baseFrame,
  390.                                          ODShape* frameShape, ODPart* embedPart,
  391.                                          ODTypeToken viewType, ODTypeToken presentation,
  392.                                           ODBoolean isOverlaid);
  393.     void        RemoveEmbeddedFrame     (Environment* ev, ODFrame* embeddedFrame);
  394.     ODShape*    RequestFrameShape       (Environment* ev, ODFrame* embeddedFrame,
  395.                                          ODShape* frameShape);
  396.     void        UsedShapeChanged        (Environment* ev, ODFrame* embeddedFrame);
  397.     ODShape*    AdjustBorderShape       (Environment* ev, ODFacet* embeddedFacet,
  398.                                          ODShape* shape);
  399.     void        ContainingPartPropertiesChanged
  400.                                         (Environment* ev, ODFrame* frame,
  401.                                          ODStorageUnit* propertyUnit);
  402.     ODStorageUnit* GetContainingPartProperties
  403.                                         (Environment* ev, ODFrame* frame);
  404.     ODBoolean    RevealFrame             (Environment* ev, ODFrame* embeddedFrame,
  405.                                          ODShape* revealShape);
  406.     void        EmbeddedFrameSpec       (Environment* ev, ODFrame* embeddedFrame,
  407.                                          ODObjectSpec* spec);
  408.     ODEmbeddedFramesIterator*
  409.                 CreateEmbeddedFramesIterator
  410.                                         (Environment* ev, ODFrame* frame);
  411.  
  412.  
  413.     //====================================================================================
  414. public: // CPProcessMap - implementation-specific methods:
  415.  
  416.     void        PrivInitProcessMap         (Environment* ev, ODStorageUnit* su, ODPart* self);
  417.     void        PrivSetDirty               (Environment* ev);
  418.     ODBoolean    PrivGetDirty            (Environment* ev) {return fDirty;}
  419.     
  420.     ODWindow*     PrivCreateWindow        (Environment *ev, ODFrame* sourceFrame);
  421.     ODID         PrivOpenInitialWindow    (Environment *ev);
  422.     ODID         PrivOpenSavedWindow        (Environment *ev, ODFrame* frame);
  423.     ODBoolean    PrivWantResizableWindow    (void);
  424.  
  425.     ODBoolean    PrivHandleMenuEvent        (Environment* ev, ODFrame* frame, ODEventData* event);
  426.     ODBoolean    PrivHandleMouseDown        (Environment* ev, ODEventData* event,
  427.                                          ODFrame* frame, ODFacet* facet);
  428.     ODBoolean    PrivUsedShapeHandleMouseDown
  429.                                         (Environment* ev, ODEventData* event,
  430.                                          ODFrame* frame, ODFacet* facet);
  431.  
  432.     void        PrivInvalAllDisplayFrames (Environment* ev);
  433.     ODShape*    PrivGetFrameShape          (Environment* ev, ODFrame* frame);
  434.     ODShape*    PrivGetUsedShape           (Environment* ev, ODFrame* frame);
  435.     void        PrivAdjustFacets          (Environment* ev, ODFrame* frame);
  436.  
  437.     //====================================================================================
  438. private: // CPProcessMap - implementation-specific fields:
  439.  
  440.     ODSession*    fSession;            // Reference to session object
  441.     ODPart*        fSelf;                // Passed into InitPart and InitPartFromStorage.
  442.      ODStorageUnit*    fStorageUnit;    // Storage Unit for this Part
  443.      ODBoolean    fReadOnlyStorage;    // SU is froma locked document or draft
  444.     FrameList    fDisplayFrames;        // List of all my display frames
  445.     ODDraftKey    fDraftKey;            // For cloning purposes only
  446.  
  447.     Boolean        fDirty;                // Document dirty or not
  448.     ODID        fWindowID;            // Window ID if Show As Window
  449.  
  450.     ODFocusSet*    fFocusSet;            // Foci this part wants/has
  451.     ODTypeToken    fSelectionFocus;    // Selection Focus
  452.     ODTypeToken    fMenuFocus;            // Menu Focus
  453.     ODTypeToken    fKeyFocus;            // Keyboard Focus
  454.     ODTypeToken    fModalFocus;        // Modal Focus
  455.     
  456.     ODMenuBar*     fMenuBar;            // Menu bar
  457.     MenuHandle    fMenu;                // Handle to my one (so far) menu
  458.  
  459.     Str255        fTextData;            // Data that get Internalized/Externalized
  460.  
  461.     long    lLogicalSize;
  462.     long    lPhysicalSize;
  463.     long    lSystemHeap;
  464.     long    lAboveBufPtr;
  465.  
  466.     long lLastTick;
  467.  
  468.     short    sNumOfProcess;
  469. #define    MAX_PROCESS    20
  470.     CMyProcess* aProcesses;
  471.  
  472.     Boolean fHorizontal;
  473.     Rect rctBar;
  474.     short sSysFontHeight;
  475.     short sSysFontLeading;
  476.     char PrevName[32];
  477.  
  478.     void DrawProcessMap(Environment* ev, ODFacet* facet);
  479.     void DrawProcessName(StringPtr p, long from, long to);
  480.     Boolean RefreshProcessMap(void);
  481. };
  482.  
  483. #endif
  484.